﻿using QMERP.Domain.Enums;

namespace QMERP.Domain.Dtos
{
    public class StockActionLogMainInfoResponse
    {
        public long Id { get; set; }
        /// <summary>
        /// 库存操作类型(出库或入库)
        /// </summary>
        public string StockActionType { get; set; } = "";
        /// <summary>
        /// 业务单Id
        /// </summary>
        public long BusinessOrderId { get; set; }
        /// <summary>
        /// 业务单编号
        /// </summary>
        public string BusinessOrderNumber { get; set; } = "";
        /// <summary>
        /// 业务单明细Id
        /// </summary>
        public long BusinessOrderDetailId { get; set; }
        /// <summary>
        /// 业务类型
        /// </summary>
        public string BusinessType { get; set; } = "";
        /// <summary>
        /// 出入库片数
        /// </summary>
        public int Qty { get; set; }
        /// <summary>
        /// 库存片数
        /// </summary>
        public int StockQty { get; set; }
        /// <summary>
        /// 出入库后库存片数
        /// </summary>
        public int AfterOutOrInStockQty
        {
            get { return StockActionType == StockActionTypeEnum.EnterStock.ToString() ? StockQty + Qty : StockQty - Qty; }
        }
        /// <summary>
        /// 创建人Id
        /// </summary>
        public long CreatedBy { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreatedByName { get; set; } = "";
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedOn { get; set; } = DateTime.Now;

        /// <summary>
        /// 仓库Id
        /// </summary>
        public long WarehouseId { get; set; }
        /// <summary>
        /// 镜种Id
        /// </summary>
        public long LensId { get; set; }
        
        public WarehouseResponse Warehouse { get; set; } = new();
        public LensResponse Lens { get; set; } = new();
        public List<LensDetailResponse>? LensDetails { get; set; }

    }
}
